nan_value = float('nan') # nan固定写法
print(nan_value)

# round(num,小数位)

# 格式化输出
price = 19.9876
print(f"价格 {price:.2f}") # 19.99
price2 = 19.311
print(f"{price2:.2f}") # 19.31

from decimal import Decimal
# 精确计算
s1 = Decimal('0.1')
s2 = Decimal('0.2')
print(s1 + s2)

# 精确比较
import math
flag = math.isclose(0.1+0.2,0.3)
print(flag) # true

p = 0.1 + 0.2
p2 = 0.3
print(p == p2) # False
print(p is p2) # False

str = 'a' * 3
print(str) # aaa
t = (1,2,3) * 3
print(t)  # (1, 2, 3, 1, 2, 3, 1, 2, 3)
# d = {'a': 'a'} * 3, 报错: 不符合字典的核心用途

# 总结：Python只为那些乘法操作有明确、有用语义的数据类型实现了乘法支持。


